<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //原型上扩展方法
        Array.prototype.mypush=function mypush(){
            //1.this--arr   2.参数  n--100  arguments
            // this[this.length]=100;//添加数组的最后1位
            // return this.length;//返回新数组的长度
            
            for(var i=0;i<arguments.length;i++){
                this[this.length]=arguments[i];
            }
            return this.length;
        }

        var arr=[1,2,3];//[1,2,3,100] [1,2,3,100,200] [1,2,3,100,200,300]
        var res=arr.mypush(100,200,300);
        console.log(arr);
        console.log(res);
    </script>
</body>
</html>